home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 44
/
Aminet 44 (2001)(GTI - Schatztruhe)[!][Aug 2001].iso
/
Aminet
/
dev
/
gui
/
gtlayout.lha
/
Source
/
LTP_GetCommandWidth.c
< prev
next >
Wrap
C/C++ Source or Header
|
1999-01-02
|
888b
|
49 lines
/*
** GadTools layout toolkit
**
** Copyright © 1993-1999 by Olaf `Olsen' Barthel
** Freely distributable.
**
** :ts=4
*/
#ifndef _GTLAYOUT_GLOBAL_H
#include "gtlayout_global.h"
#endif
#include "Assert.h"
#ifdef DO_MENUS /* Support code */
/* LTP_GetCommandWidth(RootMenu *Root,ItemNode *Item):
*
* Calculate the width of a command sequence.
*/
LONG
LTP_GetCommandWidth(RootMenu *Root,ItemNode *Item)
{
LONG Width = 0;
// Skip separator bars
if(!(Item->Flags & ITEMF_IsBar))
{
// Add in the Amiga glyph
if(Item->Item.Flags & COMMSEQ)
Width = TextLength(&Root->RPort,&Item->Item.Command,1) + 2 + Root->AmigaWidth + 2;
else
{
// Add in command or submenu indicator
if(Item->Flags & (ITEMF_Command | ITEMF_HasSub))
Width = IntuiTextLength(((struct IntuiText *)Item->Item.ItemFill)->NextText) + 2;
}
}
return(Width);
}
#endif /* DO_MENUS */